package com.clickpaas.materialsprocurement.bean;

import com.bizcloud.ipaas.t0ba0ba6afb694026b6b4e4e048af2b43.d20210202135416.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MateralsDTOBean {

    /**
     * 请购单行 PMS_purchaseApplyLine
     * @return pmSpurchaseApplyLineDTO1
     */
    public PMSpurchaseApplyLineDTO pmSpurchaseApplyLineDTO() {
        try {
            return getDTO(PMSpurchaseApplyLineDTO.class);
        } catch (Exception e) {
            return new PMSpurchaseApplyLineDTO();
        }
    }

    /**
     * 物料资料 STD_materiel
     * @return STDmaterielDTO
     */
    public STDmaterielDTO stDmaterielDTO() {
        try {
            return getDTO(STDmaterielDTO.class);
        } catch (Exception e) {
            return new STDmaterielDTO();
        }
    }

    /**
     * 物料资料 STD_materiel
     * @return STDmaterielDTOQuery
     */
    public STDmaterielDTOQuery stDmaterielDTOQuery() {
        try {
            return getDTO(STDmaterielDTOQuery.class);
        } catch (Exception e) {
            return new STDmaterielDTOQuery();
        }
    }

    /**
     * 物料资料 STD_materiel
     * @return STDmaterielDTOUpdate
     */
    public STDmaterielDTOUpdate stDmaterielDTOUpdate() {
        try {
            return getDTO(STDmaterielDTOUpdate.class);
        } catch (Exception e) {
            return new STDmaterielDTOUpdate();
        }
    }

    /**
     * 物料资料 STD_materiel
     * 分页查询
     * @return STDmaterielDTOPageInfo
     */
    public STDmaterielDTOPageInfo stDmaterielDTOPageInfo() {
        try {
            return getDTO(STDmaterielDTOPageInfo.class);
        } catch (Exception e) {
            return new STDmaterielDTOPageInfo();
        }
    }

    /**
     * 共享库存 ShareWarehouse
     * @return ShareWarehouseDTO1
     */
    public ShareWarehouseDTO shareWarehouseDTO() {
        try {
            return getDTO(ShareWarehouseDTO.class);
        } catch (Exception e) {
            return new ShareWarehouseDTO();
        }
    }

    /**
     * 共享库存 ShareWarehouse
     * @return ShareWarehouseDTO1
     */
    public ShareWarehouseDTOQuery shareWarehouseDTOQuery() {
        try {
            return getDTO(ShareWarehouseDTOQuery.class);
        } catch (Exception e) {
            return new ShareWarehouseDTOQuery();
        }
    }

    /**
     * 共享库存 ShareWarehouse
     * @return ShareWarehouseDTO1
     */
    public ShareWarehouseDTOUpdate shareWarehouseDTOUpdate() {
        try {
            return getDTO(ShareWarehouseDTOUpdate.class);
        } catch (Exception e) {
            return new ShareWarehouseDTOUpdate();
        }
    }

    /**
     * 采购订单行 PurchaseLine
     * @return PurchaseLineDTO1
     */
    public PurchaseLineDTO purchaseLineDTO() {
        try {
            return getDTO(PurchaseLineDTO.class);
        } catch (Exception e) {
            return new PurchaseLineDTO();
        }
    }

    /**
     * 采购订单行 PurchaseLine
     * @return PurchaseLineDTOQuery
     */
    public PurchaseLineDTOQuery purchaseLineDTOQuery() {
        try {
            return getDTO(PurchaseLineDTOQuery.class);
        } catch (Exception e) {
            return new PurchaseLineDTOQuery();
        }
    }

    /**
     * 采购订单行 PurchaseLine
     * @return PurchaseLineDTO1
     */
    public PurchaseLineDTOUpdate purchaseLineDTOUpdate() {
        try {
            return getDTO(PurchaseLineDTOUpdate.class);
        } catch (Exception e) {
            return new PurchaseLineDTOUpdate();
        }
    }

    /**
     * 成本中心 CostCenter
     * @return CostCenterDTO1
     */
    public CostCenterDTO costCenterDTO() {
        try {
            return getDTO(CostCenterDTO.class);
        } catch (Exception e) {
            return new CostCenterDTO();
        }
    }

    /**
     * 单位 Unit
     * @return UnitDTO1
     */
    public UnitDTO unitDTO() {
        try {
            return getDTO(UnitDTO.class);
        } catch (Exception e) {
            return new UnitDTO();
        }
    }

    /**
     * 采购订单 PurchaseOrder
     * @return PurchaseOrderDTO1
     */
    public PurchaseOrderDTO purchaseOrderDTO() {
        try {
            return getDTO(PurchaseOrderDTO.class);
        } catch (Exception e) {
            return new PurchaseOrderDTO();
        }
    }

    /**
     * 供应商资料 SupplierInformation
     * @return SupplierInformationDTO1
     */
    public SupplierInformationDTO supplierInformationDTO() {
        try {
            return getDTO(SupplierInformationDTO.class);
        } catch (Exception e) {
            return new SupplierInformationDTO();
        }
    }

    /**
     * 供应商资料 SupplierInformation
     * 分页查询
     * @return SupplierInformationDTOPageInfo
     */
    public SupplierInformationDTOPageInfo supplierInformationDTOPageInfo(){
        try {
            return getDTO(SupplierInformationDTOPageInfo.class);
        } catch (Exception e) {
            return new SupplierInformationDTOPageInfo();
        }
    }

    /**
     * 询价单行 InquiryLine
     * @return
     */
    public InquiryLineDTO inquiryLineDTO(){
        try {
            return getDTO(InquiryLineDTO.class);
        }catch (Exception e){
            return new InquiryLineDTO();
        }
    }

    /**
     * 甄选 srm_select
     * @return
     */
    public SrmselectDTO srmselectDTO(){
        try {
            return getDTO(SrmselectDTO.class);
        }catch (Exception e){
            return new SrmselectDTO();
        }
    }

    /**
     * 甄选 srm_select
     * @return
     */
    public SrmselectDTOQuery srmselectDTOQuery(){
        try {
            return getDTO(SrmselectDTOQuery.class);
        }catch (Exception e){
            return new SrmselectDTOQuery();
        }
    }

    /**
     * 甄选 srm_select
     * @return
     */
    public SrmselectDTOUpdate srmselectDTOUpdate(){
        try {
            return getDTO(SrmselectDTOUpdate.class);
        }catch (Exception e){
            return new SrmselectDTOUpdate();
        }
    }

    /**
     * 入库单 StockInOrder
     * @return StockInOrderDTO1
     */
    public StockInOrderDTO stockInOrderDTO(){
        try {
            return getDTO(StockInOrderDTO.class);
        }catch (Exception e){
            return new StockInOrderDTO();
        }
    }

    /**
     * 入库单 StockInOrder
     * @return StockInOrderDTOQuery
     */
    public StockInOrderDTOQuery stockInOrderDTOQuery(){
        try {
            return getDTO(StockInOrderDTOQuery.class);
        }catch (Exception e){
            return new StockInOrderDTOQuery();
        }
    }

    /**
     * 入库单 StockInOrder
     * @return StockInOrderDTOUpdate
     */
    public StockInOrderDTOUpdate stockInOrderDTOUpdate(){
        try {
            return getDTO(StockInOrderDTOUpdate.class);
        }catch (Exception e){
            return new StockInOrderDTOUpdate();
        }
    }

    /**
     * 获取沙箱ID
     * @param clazz
     * @param <T>
     * @return
     * @throws Exception
     */
    private  <T> T getDTO(Class<T> clazz) throws Exception {
        T t = (T) clazz.newInstance();
        /*Method setatsandboxDBId = null;
        try {
            setatsandboxDBId = t.getClass().getDeclaredMethod(ConstantFile._SET_AT_SANDBOXDB_ID, String.class);
            if (StringUtils.isNotBlank(AutoLoadConfig.SANDBOX_ID)){
                setatsandboxDBId.invoke(t,AutoLoadConfig.SANDBOX_ID);
            }
        }catch (Exception e){
            log.info("对象【{}】获取沙箱ID失败！",t);
            return (T) t;
        }*/
        return (T) t;
    }

}
